# 导包
import requests
import app

# 定义接口类
class EmployeeAPL():
    # 初始化
    def __init__(self):
        self.employee_add_url = app.BASE_URL + '/api/sys/user'
        self.employee_update_url = app.BASE_URL + '/api/sys/user/{}'
        self.employee_get_url = app.BASE_URL + '/api/sys/user/{}'
        self.employee_delete_url = app.BASE_URL + '/api/sys/user/{}'

    # 员工添加
    def employee_add(self,employee_add_data):
        return requests.post(url=self.employee_add_url,json=employee_add_data,headers=app.headers_data)

    # 员工修改
    def employee_update(self,employee_id,employee_update_data):
        url = self.employee_update_url.format(employee_id)
        return requests.put(url=url,json=employee_update_data,headers=app.headers_data)

    # 员工查询
    def employee_get(self,employee_id):
        url = self.employee_get_url.format(employee_id)
        return requests.get(url=url, headers=app.headers_data)

    # 员工删除
    def employee_delete(self,employee_id):
        url = self.employee_delete_url.format(employee_id)
        return requests.delete(url=url, headers=app.headers_data)

